<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/jquery_min.js"></script>
    
   
</head>
<body>
    <!-- 遍历checkbox控件，输出选中个数 -->
    <div>
    <input type="checkbox" value="1" name="check" checked="checked" />
    <input type="checkbox" value="2" name="check"  />
    <input type="checkbox" value="3" name="check" checked="checked" />
    <input type="checkbox" value="4" name="check"   />
     </div>
    <!-- 设置表格序号为偶数行的文本颜色 -->
    <table id="tab">
        <tbody>
            <tr>
                <td>第一行</td><td>第一行</td>
            </tr>
            <tr>
                <td>第二行</td><td>第二行</td>
            </tr>
            <tr>
                <td>第三行</td><td>第三行</td>
            </tr>
            <tr>
                <td>第四行</td><td>第四行</td>
            </tr>
            <tr>
                <td>第五行</td><td>第五行</td>
            </tr>
        </tbody>
    </table>
    <script>
        $(function(){
        var div=$('div')[0]
        div.onchange=()=>{
            var a =$('input:checked')
            console.log(a.length);
        }
          for (let index = 0; index < 6; index++) {
            index = index+1
            $('#tab tr').eq(index).css('color','red')
          }
        })
    </script>
</body>
</html>